package jjn.acwing.weekly;

import java.util.Scanner;

/**
 * @author Jjn
 * @since 2023/8/19 19:01
 */
public class Acwing5137 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        for (int i = 0; i <= t; i++) {
            int num = scanner.nextInt();
            System.out.println((num - 1) / 2);
        }
    }
}
